获取隔离点信息字段时,如果在该隔离点已填写信息则返回之前填写的,返回隔离点名字

FFIB 3 years ago
parent
commit
5343c75c8b
1 changed files with 9 additions and 0 deletions
  1. 9 0
      api/point_views.py

+ 9 - 0
api/point_views.py

@@ -57,6 +57,7 @@ def get_point_info(request):
57 57
 
58 58
 @logit
59 59
 def get_point_fields(request):
60
+    user_id = request.POST.get('user_id', '')
60 61
     point_id = request.POST.get('point_id', '')
61 62
 
62 63
     try:
@@ -64,8 +65,16 @@ def get_point_fields(request):
64 65
     except IsolationPointInfo.DoesNotExist:
65 66
         return response(IsolationPointStatusCode.ISOLATIONPOINT_NOT_FOUND)
66 67
 
68
+    try:
69
+        user_info = IsolationPointUserInfo.objects.get(user_id=user_id, point_id=point_id, status=True)
70
+        user_info = user_info.fields
71
+    except IsolationPointUserInfo.DoesNotExist:
72
+        user_info = []
73
+
67 74
     return response(data={
75
+        'point_name': point.point_name,
68 76
         'fields': point.point_fields,
77
+        'user_info': user_info,
69 78
     })
70 79
 
71 80